﻿@model dynamic

@{
    ViewBag.Title = "系统日志";

}
<!--分页-->
<div data-bind="with:page">
    <a class="am-badge  am-radius  am-text-sm am-badge-secondary" data-bind="click:function(){$root.gopage(1)}">第一页</a>
    <a class="am-badge  am-radius  am-text-sm am-badge-secondary" data-bind="click:function(){$root.gopage(up)}">上一页</a>
    <!--ko foreach: vp-->
    <a class="am-badge  am-radius  am-text-sm" data-bind="css:{'am-badge-secondary ':$data!=$parent.page,'disabled':$data==$parent.page},text:$data,click:function(){$root.gopage($data)}">2</a>
    <!--/ko -->

    <a class="am-badge  am-radius  am-text-sm am-badge-secondary" data-bind="click:function(){$root.gopage(next)}">下一页</a>
    <a class="am-badge  am-radius  am-text-sm am-badge-secondary" data-bind="click:function(){$root.gopage(total)}">最后一页</a>
</div>
<!--分页-->
<table class="am-table am-table-striped am-table-hover table-main">
    <tbody data-bind="foreach:$root.datalist">
        <tr>
            <td>
                <span class="am-text-success" data-bind="text:AddTime"></span>
            </td>
            <td><span class="am-text-danger" data-bind="text:Name"></span></td>
            <td> <a href="javascript:void(0)" class="am-link-muted" data-bind="text:substr(Details),click:function(){$root.showstr(Details)}"> </a></td>
            <td><span class="am-text-primary" data-bind="text:substr(Url),click:function(){$root.showstr(Url)}"></span></td>
            <td><span class="am-text-warning" data-bind="text:'uid:'+ Userid"></span></td>
            <td><span class="am-text-warning" data-bind="text:UsingIp"></span></td>
            <td><a href="javascript:void(0)" class="am-text-secondary" data-bind=" text:substr(Remarks),click:function(){$root.showstr(Remarks)}"></a></td>
        </tr>
    </tbody>
</table>
<!--分页-->
<div data-bind="with:page">
    <a class="am-badge  am-radius  am-text-sm am-badge-secondary" data-bind="click:function(){$root.gopage(1)}">第一页</a>
    <a class="am-badge  am-radius  am-text-sm am-badge-secondary" data-bind="click:function(){$root.gopage(up)}">上一页</a>
    <!--ko foreach: vp-->
    <a class="am-badge  am-radius  am-text-sm" data-bind="css:{'am-badge-secondary ':$data!=$parent.page,'disabled':$data==$parent.page},text:$data,click:function(){$root.gopage($data)}">2</a>
    <!--/ko -->

    <a class="am-badge  am-radius  am-text-sm am-badge-secondary" data-bind="click:function(){$root.gopage(next)}">下一页</a>
    <a class="am-badge  am-radius  am-text-sm am-badge-secondary" data-bind="click:function(){$root.gopage(total)}">最后一页</a>
</div>
<!--分页-->

<!--显示详细信息-->
@Html.Partial("alert")

@section scripts{
    <script type="text/javascript" src="/Resource/knockout-3.3.0.js"> </script>
    <script type="text/javascript">
        function Kvm() {
            var k = this;
            //数据集
            k.page = ko.observable();
            k.datalist = ko.observableArray([]);
            //显示字符
            k.showstr = function (str    ) {
                $('#alert').modal('open');
                $('#alertMs').text(str);

            }
            k.gopage = function (page) {
                fy(page);
            }
        }

        var kvm = new Kvm();
        ko.applyBindings(kvm);

        //获取数据
        function fy(page, rows) {
            //行数
            rows = rows || 60;
            $.doPost('@Url.Action("DataXtLog", "Admin")', { page: page, rows: rows }, function (d) {
                var opage = $page(page, rows, d.data.count); //绑定
                kvm.page(opage);
                kvm.datalist(d.data.datalist);


            });
        }
      

        $(function () {
            fy(1);

        });


    </script>
}
